//------------------------------------------------------------------------------
// X2D Game Engine
// Copyright (C) 2006-2007 Janusz Kowalski
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program.  If not, see <http://www.gnu.org/licenses/>.
//------------------------------------------------------------------------------

// - Wyświetlanie poniższego komunikatu w trybie edycji
// static char *msg_help =
//   "*** HELP ***\n\n"
//   "Q - LEAVE THE PROGRAM          \n"
//   "E - TOGGLE EDIT MODE           \n"
//   "LEFT, RIGHT, ... - MAP MOVEMENT\n"
//   "1,2,3 - CHANGE CURRENT PLANE   \n"
//   "TAB - TOGGLE PLANES VISIBILITY \n"
//   "S - SAVE CURRENT MAP           \n"
//   "L - LOAD SAVED MAP             \n"
//   "H - DISPLAY THIS HELP MESSAGE  \n"
//   "C - CLEAR MAP                  \n";

#include <cstdio>

#include "global.h"
#include "x2d_main.h"
#include "pmsg.h"
#include "os.h"

int main (int argc, char *argv[])
{
  // Prepare log file.
  const char *LOG_FILE_NAME = "log.txt";
  try {
    FILE *logFile = fileOpenWrite(LOG_FILE_NAME);
    pmsgSetLogStream(logFile);
  } catch (...) {
    pmsgWarningF("Log file '%s' cannot be opened\n", LOG_FILE_NAME);
  }
  
  // Log some basic information.
  pmsgInfoF("%s\n", NAME_FULL);
  pmsgInfoF("Compiled: %s %s\n", __DATE__, __TIME__);
  
  // Run the main program.
  // !! What if it fails? EXIT_SUCCESS ?!
  x2d::mainInit(argc, argv);

  return EXIT_SUCCESS;
}
